home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 4
/
Apprentice-Release4.iso
/
Source Code
/
C
/
Frameworks
/
Grant's CGI Framework 1.0b12
/
Util
/
StringUtil.c
< prev
next >
Wrap
Text File
|
1995-12-09
|
1KB
|
78 lines
/*****
*
* StringUtil.c
*
* This is a support file for "Grant's CGI Framework".
* Please see the license agreement that accompanies the distribution package
* for licensing details.
*
* Copyright ©1995 by Grant Neufeld
* grant@acm.com
* http://arpp1.carleton.ca/grant/
*
*****/
#include <string.h>
#include "compiler_stuff.h"
#include "StringUtil.h"
/*** FUNCTIONS ***/
/* Copy pascal format srcStr to the destStr */
void
StringPascalCopy ( char *srcStr, char *destStr )
{
BlockMove ( srcStr, destStr, (srcStr[nil]) + 1 );
} /* StringPascalCopy */
/* count the occurances of theChar in theString */
long
StringCountChar ( char *theString, char theChar )
{
long total;
char * tempStr;
total = nil;
tempStr = theString;
do
{
tempStr = StringChar ( tempStr, theChar );
if ( (tempStr != nil) && (*tempStr != nil) )
{
tempStr++;
total++;
}
} while ( (tempStr != nil) && (*tempStr != nil) );
return total;
} /* strcountchr */
/* working version of strchr for TPM */
#if kCompiling_For_Symantec
char *
StringChar ( const char *theString, unsigned char theChar )
{
do
{
if ( *theString == theChar )
{
/* found the character, return a pointer to it */
return (char *)theString;
}
theString++;
} while ( *theString != nil );
/* didn't find the character */
return nil;
} /* StringChar */
#endif
/*** EOF ***/